package smdc.order.service.impl;

import java.util.List;
import smdc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import smdc.order.mapper.MenuCategoryMapper;
import smdc.order.domain.MenuCategory;
import smdc.order.service.IMenuCategoryService;

/**
 * 菜单分类Service业务层处理
 * 
 * @author 毛锐
 * @date 2025-03-28
 */
@Service
public class MenuCategoryServiceImpl implements IMenuCategoryService 
{
    @Autowired
    private MenuCategoryMapper menuCategoryMapper;

    /**
     * 查询菜单分类
     * 
     * @param categoryId 菜单分类主键
     * @return 菜单分类
     */
    @Override
    public MenuCategory selectMenuCategoryByCategoryId(Long categoryId)
    {
        return menuCategoryMapper.selectMenuCategoryByCategoryId(categoryId);
    }

    /**
     * 查询菜单分类列表
     * 
     * @param menuCategory 菜单分类
     * @return 菜单分类
     */
    @Override
    public List<MenuCategory> selectMenuCategoryList(MenuCategory menuCategory)
    {
        return menuCategoryMapper.selectMenuCategoryList(menuCategory);
    }

    /**
     * 新增菜单分类
     * 
     * @param menuCategory 菜单分类
     * @return 结果
     */
    @Override
    public int insertMenuCategory(MenuCategory menuCategory)
    {
        menuCategory.setCreateTime(DateUtils.getNowDate());
        return menuCategoryMapper.insertMenuCategory(menuCategory);
    }

    /**
     * 修改菜单分类
     * 
     * @param menuCategory 菜单分类
     * @return 结果
     */
    @Override
    public int updateMenuCategory(MenuCategory menuCategory)
    {
        menuCategory.setUpdateTime(DateUtils.getNowDate());
        return menuCategoryMapper.updateMenuCategory(menuCategory);
    }

    /**
     * 批量删除菜单分类
     * 
     * @param categoryIds 需要删除的菜单分类主键
     * @return 结果
     */
    @Override
    public int deleteMenuCategoryByCategoryIds(Long[] categoryIds)
    {
        return menuCategoryMapper.deleteMenuCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除菜单分类信息
     * 
     * @param categoryId 菜单分类主键
     * @return 结果
     */
    @Override
    public int deleteMenuCategoryByCategoryId(Long categoryId)
    {
        return menuCategoryMapper.deleteMenuCategoryByCategoryId(categoryId);
    }
}
